﻿using System;
using System.Collections.Generic;
using System.IO;

// Token: 0x020002FB RID: 763
public class FolderAssist
{
	// Token: 0x060012AE RID: 4782 RVA: 0x00097B64 File Offset: 0x00095D64
	public virtual int GetFileCount()
	{
		return this.lstFile.Count;
	}

	// Token: 0x060012AF RID: 4783 RVA: 0x00097B74 File Offset: 0x00095D74
	public virtual bool CreateFolderInfo(string folder, string searchPattern, bool getFiles = true, bool clear = true)
	{
		if (clear)
		{
			this.lstFile.Clear();
		}
		if (!Directory.Exists(folder))
		{
			return false;
		}
		string[] array;
		if (getFiles)
		{
			array = Directory.GetFiles(folder, searchPattern);
		}
		else
		{
			array = Directory.GetDirectories(folder);
		}
		if (array.Length == 0)
		{
			return false;
		}
		foreach (string text in array)
		{
			global::FolderAssist.FileInfo fileInfo = new global::FolderAssist.FileInfo();
			fileInfo.FullPath = text;
			if (getFiles)
			{
				fileInfo.FileName = Path.GetFileNameWithoutExtension(text);
			}
			fileInfo.time = File.GetLastWriteTime(text);
			this.lstFile.Add(fileInfo);
		}
		return true;
	}

	// Token: 0x060012B0 RID: 4784 RVA: 0x00097C20 File Offset: 0x00095E20
	public virtual bool CreateFolderInfoEx(string folder, string[] searchPattern, bool clear = true)
	{
		if (clear)
		{
			this.lstFile.Clear();
		}
		if (!Directory.Exists(folder))
		{
			return false;
		}
		List<string> list = new List<string>();
		foreach (string searchPattern2 in searchPattern)
		{
			list.AddRange(Directory.GetFiles(folder, searchPattern2));
		}
		string[] array = list.ToArray();
		if (array.Length == 0)
		{
			return false;
		}
		foreach (string text in array)
		{
			global::FolderAssist.FileInfo fileInfo = new global::FolderAssist.FileInfo();
			fileInfo.FullPath = text;
			fileInfo.FileName = Path.GetFileNameWithoutExtension(text);
			fileInfo.time = File.GetLastWriteTime(text);
			this.lstFile.Add(fileInfo);
		}
		return true;
	}

	// Token: 0x060012B1 RID: 4785 RVA: 0x00097CEC File Offset: 0x00095EEC
	public virtual int GetIndexFromFileName(string filename)
	{
		int num = 0;
		foreach (global::FolderAssist.FileInfo fileInfo in this.lstFile)
		{
			if (fileInfo.FileName == filename)
			{
				return num;
			}
			num++;
		}
		return -1;
	}

	// Token: 0x060012B2 RID: 4786 RVA: 0x00097D60 File Offset: 0x00095F60
	public virtual void SortName(bool ascend = true)
	{
		if (this.lstFile.Count == 0)
		{
			return;
		}
		if (ascend)
		{
			this.lstFile.Sort((global::FolderAssist.FileInfo a, global::FolderAssist.FileInfo b) => a.FileName.CompareTo(b.FileName));
		}
		else
		{
			this.lstFile.Sort((global::FolderAssist.FileInfo a, global::FolderAssist.FileInfo b) => b.FileName.CompareTo(a.FileName));
		}
	}

	// Token: 0x060012B3 RID: 4787 RVA: 0x00097DDC File Offset: 0x00095FDC
	public virtual void SortDate(bool ascend = true)
	{
		if (this.lstFile.Count == 0)
		{
			return;
		}
		if (ascend)
		{
			this.lstFile.Sort((global::FolderAssist.FileInfo a, global::FolderAssist.FileInfo b) => a.time.CompareTo(b.time));
		}
		else
		{
			this.lstFile.Sort((global::FolderAssist.FileInfo a, global::FolderAssist.FileInfo b) => b.time.CompareTo(a.time));
		}
	}

	// Token: 0x04001891 RID: 6289
	public List<global::FolderAssist.FileInfo> lstFile = new List<global::FolderAssist.FileInfo>();

	// Token: 0x020002FC RID: 764
	public class FileInfo
	{
		// Token: 0x060012B8 RID: 4792 RVA: 0x00097EA8 File Offset: 0x000960A8
		public FileInfo()
		{
		}

		// Token: 0x060012B9 RID: 4793 RVA: 0x00097EC8 File Offset: 0x000960C8
		public FileInfo(global::FolderAssist.FileInfo src)
		{
			this.FullPath = src.FullPath;
			this.FileName = src.FileName;
			this.time = src.time;
		}

		// Token: 0x060012BA RID: 4794 RVA: 0x00097F18 File Offset: 0x00096118
		public virtual void Copy(global::FolderAssist.FileInfo src)
		{
			this.FullPath = src.FullPath;
			this.FileName = src.FileName;
			this.time = src.time;
		}

		// Token: 0x04001896 RID: 6294
		public string FullPath = string.Empty;

		// Token: 0x04001897 RID: 6295
		public string FileName = string.Empty;

		// Token: 0x04001898 RID: 6296
		public DateTime time;
	}
}
